import Page
from Page import Xkan
from Base.Base import Base
from selenium.webdriver.common.by import By


class XkanIndexPage(Base):
    """
    多媒体首页

    个性主题的语音音色页、全息形象页、整车音效页可复用此页
    """

    def __init__(self, driver):
        Base.__init__(self, driver)

        # 左侧的home键
        self.xkan_home_btn = (By.XPATH, Xkan.RESOURCE_ID.format("ivHome"))

        # 左侧的返回键
        self.xkan_back_btn = (By.XPATH, Xkan.RESOURCE_ID.format('ivBack'))

        # 首页未连接封面
        self.xkan_no_connected_img = (By.XPATH, Xkan.RESOURCE_ID.format("iv_empty"))

        # 首页未连接文案
        self.xkan_no_connected_tip_text = (By.XPATH, Xkan.RESOURCE_ID.format("tv_empty"))

    def click_home(self):
        """
        点击左侧的home键

        :return:None
        """
        self.click_element(self.xkan_home_btn)

    def click_back(self):
        """
        点击左侧的back键

        :return:None
        """
        self.click_element(self.xkan_back_btn)

    def get_no_connected(self):
        """
        获取未连接封面图片

        :return:获取元素
        """
        return self.find_element_o(self.xkan_no_connected_img)

    def get_no_connected_tip(self):
        """
        获取未连接封面文案

        :return:获取元素
        """
        return self.find_element_o(self.xkan_no_connected_tip_text)

    def is_display_xkan_index(self):
        """
        查看是否进入想看首页

        :return:
        """
        return self.is_display(self.xkan_no_connected_tip_text)
